<!--
 *@开发者: 刘翔
 *@创建时间: 2024-04-26 10:33:30
 *@描述:表格2(标题居左列，内容居右列)
!-->
<template>
  <div class="form-list">
    <div class="form-item" v-for="(itemData, itemIndex) in formParameter" :key="itemIndex" :style="{ height: 100 / formParameter.length + '%' }">
      <div class="form-item-title">{{ itemData.title }}</div>
      <div class="form-item-content" v-for="(item, index) in data_list" :key="index">
        <div
          class="form-item-content-item"
          :style="{
            color: itemData.highlightValue && item[itemData.highlightValue] ? '#ff1c0f' : '#000',
          }"
          v-if="item[itemData.title]"
        >
          {{ item[itemData.title] }}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  // 组件名称
  name: 'formList',
  // 组件参数 接收来自父组件的数据
  props: {
    formParameter: {
      type: Array,
      default: () => {
        return [];
      },
    },
    data_list: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  // 局部注册的组件
  components: {},
  // 组件状态值
  data() {
    return {};
  },
  // 计算属性
  computed: {},
  // 侦听器
  watch: {},
  // 组件方法
  methods: {},
  created() {},
  mounted() {},
};
</script>

<style lang="less" scoped>
.form-list {
  --borderColor: #000;
  width: 92%;
  height: 100%;
  border: 1px solid var(--borderColor);
  font-size: 1.2rem;
  .form-item {
    display: flex;
    border-bottom: 1px solid var(--borderColor);
    &:last-child {
      border-bottom: 0;
    }
    .form-item-title {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 10%;
      text-align: center;
      font-size: 1.3rem;
      color: #fff;
      background: #4874cb;
    }
    .form-item-content {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.3rem;
      text-align: center;
      border-left: 1px solid var(--borderColor);
      .form-item-content-item {
      }
    }
  }
}
</style>
